package com.mes.system.service;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.annotation.DataResolver;
import com.mes.common.service.BasicService;
import com.mes.system.dao.iface.IRoleDao;
import com.mes.system.domain.Role;
import com.mes.system.manager.iface.IRoleManager;

@Service
public class RoleService extends BasicService<Role> {

	@Autowired
	private IRoleDao roleDao;
	
	@Autowired
	private IRoleManager roleManager;
	
	@DataResolver
	public void saveSRole(Map<String, Collection<Role>> dataItems) throws Exception {
		
		roleManager.saveSRole(dataItems);
		
	}
	
	@DataProvider
	public List<Role> getRolesByEmployeeUid(String employeeUid) throws Exception{
		return roleDao.getRolesByEmployeeUid(employeeUid);
	}
	
	/**
	 * 得到不属于该用户的角色
	 * @param employeeUid
	 * @return
	 * @throws Exception
	 */
	@DataProvider
	public List<Role> getRolesNoEmployee(String employeeUid) throws Exception{
		return roleDao.getRolesNoEmployee(employeeUid);
	}
	
	
	
}
